﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using StructureMap;
using StructureMap.Configuration.DSL;
using Press.MVC.Services;
using Press.MVC.Data;
using StructureMap.Attributes;
using Press.MVC.Data.DataAccess.SqlServer;


namespace Press.MVC.Web 
{
    public static class Bootstrapper 
    {

        public static void ConfigureStructureMap() {
            StructureMapConfiguration.AddRegistry(new DBServiceRegistry());
            StructureMapConfiguration.AddRegistry(new PressRegistry());
        }
    }

    public class PressRegistry : Registry 
    {
        protected override void configure() {
            
            ForRequestedType<IUserService>().TheDefaultIsConcreteType<UserService>();
            
            ForRequestedType<IUserRepository>().TheDefaultIsConcreteType<SqlUserRepository>();

            ForRequestedType<IDBUtil>().TheDefaultIsConcreteType<DBUtil>();

            ForRequestedType<IDBUtilService>().TheDefaultIsConcreteType<DBUtilService>();

            ForRequestedType<IBlogService>().TheDefaultIsConcreteType<BlogService>();
            
            ForRequestedType<IBlogRepository>().TheDefaultIsConcreteType<SqlBlogRepository>();

        }
    }
}
